package com.foreknow.dao.impl;

import com.foreknow.dao.AdminDao;
import com.foreknow.mapping.EntityMapping;
import com.foreknow.mapping.MappingFactory;
import com.foreknow.model.Admin;

import java.sql.SQLException;
import java.util.List;

public class AdminDaoimpl extends BaseDAO implements AdminDao{

    @Override
    public Admin isCheckLogin(String username, String password)throws SQLException {
        String sql = "select * from admin where username=? and password=? ";
        EntityMapping mapping= this.mappingFactory.getMap(MappingFactory.ADMIN_MAPPING);
        List<Object> list= jdbcTemplate.query(sql, mapping, password,username);
        if (list.size()>0) {
            return (Admin) list.get(0);
        }
        return  null;
    }
}



